package Chamado;

import java.io.IOException;
import java.util.Date;
import java.util.logging.Logger;
import javax.jdo.PersistenceManager;
import javax.servlet.http.*;


public class SignChamadoServlet extends HttpServlet {
    private static final Logger log = Logger.getLogger(SignChamadoServlet.class.getName());

    public void doPost(HttpServletRequest req, HttpServletResponse resp)
                throws IOException {
//        UserService userService = UserServiceFactory.getUserService();
//        User user = userService.getCurrentUser();

        String nomeSolic = req.getParameter("nomeSolic");

        String setor = req.getParameter("setor");

        Date dataHora = new Date();

        String descricaoProblema = req.getParameter("descricaoProblema");

        String descricaoSolucao = req.getParameter("descricaoSolucao");


         Chamado chamados = new Chamado(nomeSolic,setor,dataHora,descricaoProblema, descricaoSolucao );

        PersistenceManager pm = PMF.get().getPersistenceManager();
        try {
            pm.makePersistent(chamados);
        } finally {
            pm.close();
        }

        resp.sendRedirect("/Corpo.jsp");
    }
}
